<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh-CN">
<head th:replace="fragments/header :: common-header">
    <title>登录 - 景点投票系统</title>
</head>
<body>
<div th:replace="fragments/navbar :: navbar"></div>

<div class="container mt-5">
    <div class="row justify-content-center">
        <div class="col-md-6 col-lg-4">
            <div class="card shadow">
                <div class="card-header bg-primary text-white">
                    <h4 class="mb-0">用户登录</h4>
                </div>
                <div class="card-body">
                    <form th:action="@{/login}" method="post">
                        <div th:if="${msg}" class="alert alert-warning" th:text="${msg}"></div>

                        <div class="mb-3">
                            <label for="username" class="form-label">用户名</label>
                            <input type="text" class="form-control" id="username" name="username" required>
                        </div>
                        <div class="mb-3">
                            <label for="password" class="form-label">密码</label>
                            <input type="password" class="form-control" id="password" name="password" required>
                        </div>
                        <div class="d-grid gap-2">
                            <button type="submit" class="btn btn-primary">登录</button>
                        </div>
                    </form>
                    <div class="mt-3 text-center">
                        <span>还没有账号？</span>
                        <a th:href="@{/register}">立即注册</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- Bootstrap JS -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>